<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      //实现map方法
      const myMap = (callback, array) => {
        let result = [];
        for (let i = 0; i < array.length; i++) {
          result.push(callback(array[i], i, array));
        }
        return result;
      };
      const array = [1, 5, 3, 8, 19, 22, 7];
      myMap((item, index, array) => {
        console.log(item, index, array);
      }, array);
    </script>
  </body>
</html>
